import request from "@/utils/request";

const COMMON_BASE_URL = "/api";

export const HMI_PTST_API = {
  // 查询数据和定值的一次二次设置
  fetchPtstSettings: (cpu: number) => {
    return request<any, PtstSettingItem[][]>({
      url: `${COMMON_BASE_URL}/ptst/${cpu}`,
      method: "get",
    });
  },
  // 修改数据和定值的一次二次设置
  updatePtstSettings: (cpu: number, data: PtstUpdateRequest[]) => {
    return request<any, PtstUpdateResponse>({
      url: `${COMMON_BASE_URL}/ptst/${cpu}`,
      method: "post",
      data,
    });
  },
};

// 数据结构定义
// export interface PtstSettingsResponse {
//   data: PtstSettingItem[][];
// }

export interface PtstSettingItem {
  Data?: number;
  Setting?: number;
  FakeEnum: PtstEnumItem[];
}

export interface PtstEnumItem {
  Value: number;
  Desc: string;
}

export interface PtstUpdateRequest {
  Data?: number;
  Setting?: number;
}

export interface PtstUpdateResponse {
  status: string;
  message?: string;
  error?: string;
}
